Conversation
|
Tests are missing and are yet to be implemented before merging of the PR. |
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Pull Request Overview
This PR adds basic stress calculation functions for structural mechanics, introducing a new struct_mech module with comprehensive stress analysis capabilities. The implementation includes principal stress calculations, equivalent stress measures (von Mises, Tresca), and utility functions for handling Voigt notation tensors.
- Implements fundamental stress metrics including principal stresses, hydrostatic stress, von Mises stress, and Tresca stress
- Adds utility functions for Voigt notation handling and tensor conversions
- Updates pre-commit hook versions to resolve mypy compatibility issues with numpy.linalg
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/fatpy/utils/voigt.py | New utility module for Voigt notation vector handling and tensor conversion |
| src/fatpy/struct_mech/stress.py | Main stress calculation module with principal stresses, equivalent stresses, and invariants |
| src/fatpy/structural_mechanics/eq_stresses.py | Removed placeholder content |
| .python-version | Added Python 3.12 version specification |
| .pre-commit-config.yaml | Updated pre-commit hook versions for compatibility |
Comments suppressed due to low confidence (1)
src/fatpy/struct_mech/stress.py:1
- The
if __name__ == "__main__":block contains commented-out test code and should be removed from production code. This type of debugging/example code belongs in tests or documentation, not in the main module."
"""Calculate fundamental stress metrics and invariants.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
KarasTomas
left a comment
There was a problem hiding this comment.
Overall the main changes are for the Voigt vector and tensor handling in utils/voigt.py.
The option for adding time as another dimension for stress data as well as component ordering should be further discussed.
|
Changes implemented: functions now utilize vectors of shape (... , 6) @KarasTomas please look at implemented tests, review the changes |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 12 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/fatpy/struct_mech/stress.py:1
- The eigenvalues from
np.linalg.eigvalshare returned in ascending order, but the function expects descending order. Usingprincipals[0]andprincipals[2]assumes descending order (σ1, σ2, σ3), buteigvalshreturns ascending order. This should useprincipals[-1]andprincipals[0]or sort the eigenvalues first.
"""Calculate fundamental stress metrics and invariants.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
KarasTomas
left a comment
There was a problem hiding this comment.
The updated version correctly implements the variable stress vector dimension as requested.
Tests were also implemented.
Function docstrings were upgraded as well.
…into struct-mech-stress
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 12 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
KarasTomas
left a comment
There was a problem hiding this comment.
The stress functionality is ready for merge to main.
Adding basic stress calculation functions based on #12 .
Currently did not implement generics as for the sake of simplicity.
Mypy precommit hook version has been upgraded to resolve np.linalg mypy errors.
Please check validity calculation functions @KarasTomas.